//
//  ViewController.m
//  CheckersGame
//
//  Created by  on 11-11-23.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import "ViewController.h"
#import "BoardViewController.h"

@implementation ViewController

@synthesize currentView;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
}

// The Player pressed the new game button from the welcom screen
- (IBAction)didSelectNewGame:(id)sender
{
    // Initialize the game board controller, reuse the one in memory if possible
    if (settingsController == nil) 
        settingsController = [[SettingsViewController alloc] init];
    
    // Show the settings view
    [self.navigationController pushViewController:settingsController animated:YES];
}

// The Player pressed the game stat button from the welcome screen
- (IBAction)didSelectGameStats:(id)sender
{
    // Initialize the game board controller, reuse the one in memory if possible
    if (statisticsController == nil) 
    {
        statisticsController = [[StatisticsViewController alloc] init];
    }
    else
    {
        //[statisticsController.table reloadData];
    }
    
    //GameHistoryController *history = [[GameHistoryController alloc] initWithStyle:UITableViewStylePlain];
    
    
    // Show the settings
    [self.navigationController pushViewController:statisticsController animated:YES];
    //[self.navigationController pushViewController:history animated:YES];
}

- (void)viewDidLoad {
    // display Welcome screen
  //  currentView = [[View01 alloc] init];
    //[self.view addSubview:currentView.view];
    
    [self.navigationController setNavigationBarHidden:NO animated:YES];
    self.navigationItem.title = @"Welcome!";
    [super viewDidLoad];
}

#pragma mark - View lifecycle

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
	[super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
	[super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
